package com.test.construtor;

public class Student  extends Person{
	
	 int studentId;
	 public void study() {
		 System.out.println("in study");
	 }
	 
	 
	public static void main(String[] args) {
		
		 // implicite type casting.. 
		    Student student=new Student(); // total inheritance 

		     student.study();
		    
		    // implicite or upcasting 
		    Person person=new Person(); // polymorphic  assignment of object 
		    //explicite or downcasting 
		    if( person instanceof Student) {
		    Student student2=(Student)person;
		    student2.study();
		    }else {
		    	System.out.println("nt able to downcast invalid object available");
		    }
		    
		    
		     Object object=new Student();
		     Object object2=new Person();
		     Object object3=new Doctor();
		     
		    Person person2=new Doctor();
		    //parent reference variable wil be always left side and child always right side. 
		    
		    
		    
	}

}
